{"ast":null,"code":"import mime from\"mime\";import{getUserName}from\"./User\";export var isMe=function isMe(user,store){return store.getProfile().id===user.id;};export var checkRead=function checkRead(read){return read.items&&read.items.length>0;};export var checkMimeType=function checkMimeType(content,type){var _mime$getType;return!!(content.link&&(_mime$getType=mime.getType(content.link))!==null&&_mime$getType!==void 0&&_mime$getType.includes(type));};export var getHelloMessage=function getHelloMessage(store){var contentList={items:[]};var replyMessage={items:[]};var helloMessageItem={message:\"\".concat(getUserName(store.getProfile()),\", \\u043D\\u0430\\u043F\\u0438\\u0448\\u0438\\u0442\\u0435 \\u0441\\u043E\\u043E\\u0431\\u0449\\u0435\\u043D\\u0438\\u0435, \\u0447\\u0442\\u043E\\u0431\\u044B \\u043D\\u0430\\u0447\\u0430\\u0442\\u044C \\u043E\\u0431\\u0449\\u0430\\u0442\\u044C\\u0441\\u044F!\"),replyMessage:replyMessage,content:contentList};return{id:Math.floor(Math.random()*9999),user:store.getProfile(),read:{items:[]},reply:{items:[]},bodyMessage:helloMessageItem,createdAt:0,updatedAt:null};};","map":{"version":3,"names":["mime","getUserName","isMe","user","store","getProfile","id","checkRead","read","items","length","checkMimeType","content","type","link","getType","includes","getHelloMessage","contentList","replyMessage","helloMessageItem","message","Math","floor","random","reply","bodyMessage","createdAt","updatedAt"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/src/utils/Message.ts"],"sourcesContent":["import {UserListItem} from \"../models/response/UserListItem\";\nimport Store from \"../store/store\";\nimport {ReadMessageListResponse} from \"../models/response/ReadMessageListResponse\";\nimport {ContentListItem} from \"../models/response/ContentListItem\";\nimport mime from \"mime\";\nimport {MessagesListItem} from \"../models/response/MessagesListItem\";\nimport {MessageItem} from \"../models/response/MessageItem\";\nimport {ContentListResponse} from \"../models/response/ContentListResponse\";\nimport {MessagesShortListResponse} from \"../models/response/MessagesShortListResponse\";\nimport {getUserName} from \"./User\";\n\nexport const isMe = (user: UserListItem, store: Store): boolean => {\n    return store.getProfile().id === user.id;\n}\n\nexport const checkRead = (read: ReadMessageListResponse): boolean => {\n    return read.items && read.items.length > 0;\n}\n\nexport const checkMimeType = (content: ContentListItem, type:string): boolean => {\n    return !!(content.link && mime.getType(content.link)?.includes(type));\n}\n\nexport const getHelloMessage = (store: Store): MessagesListItem => {\n    const contentList: ContentListResponse = {\n        items:[]\n    };\n    const replyMessage: MessagesShortListResponse = {\n        items:[]\n    };\n    const helloMessageItem: MessageItem = {\n        message: `${getUserName(store.getProfile())}, напишите сообщение, чтобы начать общаться!`,\n        replyMessage: replyMessage,\n        content: contentList\n    };\n\n    return (\n        {\n            id: Math.floor(Math.random() * 9999),\n            user: store.getProfile(),\n            read: {items: []},\n            reply: {items:[]},\n            bodyMessage: helloMessageItem,\n            createdAt: 0,\n            updatedAt: null\n        });\n}"],"mappings":"AAIA,MAAOA,KAAI,KAAM,MAAM,CAKvB,OAAQC,WAAW,KAAO,QAAQ,CAElC,MAAO,IAAMC,KAAI,CAAG,QAAPA,KAAI,CAAIC,IAAkB,CAAEC,KAAY,CAAc,CAC/D,MAAOA,MAAK,CAACC,UAAU,EAAE,CAACC,EAAE,GAAKH,IAAI,CAACG,EAAE,CAC5C,CAAC,CAED,MAAO,IAAMC,UAAS,CAAG,QAAZA,UAAS,CAAIC,IAA6B,CAAc,CACjE,MAAOA,KAAI,CAACC,KAAK,EAAID,IAAI,CAACC,KAAK,CAACC,MAAM,CAAG,CAAC,CAC9C,CAAC,CAED,MAAO,IAAMC,cAAa,CAAG,QAAhBA,cAAa,CAAIC,OAAwB,CAAEC,IAAW,CAAc,mBAC7E,MAAO,CAAC,EAAED,OAAO,CAACE,IAAI,iBAAId,IAAI,CAACe,OAAO,CAACH,OAAO,CAACE,IAAI,CAAC,kCAA1B,cAA4BE,QAAQ,CAACH,IAAI,CAAC,CAAC,CACzE,CAAC,CAED,MAAO,IAAMI,gBAAe,CAAG,QAAlBA,gBAAe,CAAIb,KAAY,CAAuB,CAC/D,GAAMc,YAAgC,CAAG,CACrCT,KAAK,CAAC,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